#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
vector<int>ans;
const int N = 55, M = 5e5 + 10;
int a[N];
int f[M];
string s;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> s;
		if (s[0] >= '5' && s[0] <= '9') {
			cout << "1";
			for (int i = 0; i < s.size(); i++) {
				cout << 0;
			}
			cout << endl;
		}
		else {
			int idx = 0;
			bool flag = 0;
			for (int i = 1; i < s.size(); i++) {
				if (s[i] >= '5' && s[i] <= '9') {
					idx = i;
					flag = 1;
					break;
				}
			}
			if (!flag) {
				cout << s << endl;
				continue;
			}
			//cout << "idx==" << idx << endl;
			bool flag2 = 0;
			while (s[idx - 1] == '4') {
				idx--;
				if (idx == 0) {
					flag2 = 1;
					break;
				}
			}
			//cout<<"flag2==="<<flag2<<endl;
			if (flag2) {
				cout << 1;
				for (int i = 0; i < s.size(); i++) {
					cout << 0;
				}
				cout << endl;
				continue;
			}
			//cout << "idx==" << idx << endl;
			int k = s[idx - 1] - '0';

			for (int i = 0; i < idx - 1; i++) {
				cout << s[i];
			}
			cout << k + 1;
			for (int i = idx; i < s.size(); i++) {
				cout << 0;
			}
			cout << endl;
		}
	}
	return 0;
}